package com.xiaoyu.base.utils

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import com.xiaoyu.base.app.AppContext

object ClipboardUtils {

    fun clipboardText(text: String?) {
        text ?: return
        val context = AppContext.getContext()
        val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager)
                ?: return
        clipboardManager.primaryClip = ClipData.newPlainText("label", text)
    }
}